package com.jack.leetcode.eachproblem_2020;

/**
 * Created by zhang_j on 2020/11/24
 */
public class 完全二叉树的节点个数 {

    public class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;
        TreeNode(int x) { val = x; }
    }
    public int countNodes(TreeNode root) {
        if(root == null){
            return 0;
        }
        return countNodes(root.left) + countNodes(root.right) + 1;
    }
}
